<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>仪表盘 - 企业培训平台</title>
    <link rel="stylesheet" th:href="@{/css/style.css}">
    <style>
        /* General body and container styles */
        body {
            font-family: 'Inter', sans-serif;
            background-color: #f4f7f6;
            margin: 0;
            padding: 0;
            display: flex;
            min-height: 100vh;
        }

        .container {
            flex-grow: 1;
            padding: 20px;
            max-width: 1200px;
            margin: 20px auto;
            background-color: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        /* Page header */
        .page-header {
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid #e0e0e0;
        }

        .page-header h1 {
            color: #333;
            font-size: 2.5em;
            margin: 0;
        }

        .welcome-message {
            font-size: 1.2em;
            color: #555;
            margin-top: 10px;
        }

        /* Dashboard statistics cards */
        .stats-cards {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 25px;
            margin-top: 30px;
        }

        .stat-card {
            background-color: #e8f0fe; /* Light blue background */
            padding: 25px;
            border-radius: 10px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
            text-align: center;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            border: 1px solid #c0d8f7;
        }

        .stat-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
        }

        .stat-card h3 {
            color: #0056b3; /* Darker blue for title */
            font-size: 1.5em;
            margin-top: 0;
            margin-bottom: 15px;
        }

        .stat-card p {
            font-size: 2.5em;
            font-weight: bold;
            color: #333;
            margin: 0;
        }

        /* Responsive adjustments */
        @media (max-width: 768px) {
            .container {
                margin: 10px;
                padding: 15px;
            }
            .page-header h1 {
                font-size: 2em;
            }
            .welcome-message {
                font-size: 1em;
            }
            .stats-cards {
                grid-template-columns: 1fr; /* Stack cards on small screens */
            }
            .stat-card {
                padding: 20px;
            }
        }
    </style>
</head>
<body>
<div th:replace="fragments/sidebar :: sidebar"></div> <div class="main-content">
    <div class="container">
        <div class="page-header">
            <h1>仪表盘</h1>
            <p class="welcome-message">欢迎，<strong th:text="${loggedInUser.username}">用户</strong>！</p>
        </div>

        <div class="stats-cards">
            <div class="stat-card">
                <h3>总课程数</h3>
                <p th:text="${totalCourses != null ? totalCourses : 'N/A'}"></p>
            </div>
            <div class="stat-card">
                <h3>总学生数</h3>
                <p th:text="${totalStudents != null ? totalStudents : 'N/A'}"></p>
            </div>
            <div class="stat-card">
                <h3>总班级数</h3>
                <p th:text="${totalClasses != null ? totalClasses : 'N/A'}"></p>
            </div>
            <div th:if="${loggedInUser.role == 'STUDENT'}" class="stat-card">
                <h3>已加入班级数</h3>
                <p th:text="${enrolledClassesCount != null ? enrolledClassesCount : 'N/A'}"></p>
            </div>
            <div th:if="${loggedInUser.role == 'STUDENT'}" class="stat-card">
                <h3>已购买课程数</h3>
                <p th:text="${purchasedCoursesCount != null ? purchasedCoursesCount : 'N/A'}"></p>
            </div>
        </div>

    </div>
</div>
</body>
</html>
